/*
 * File:         HolidayTest.java
 * Author:       Robert Bittle <guywithnose@gmail.com>
 */
package foxtrotbravo.tests;

import static org.junit.Assert.*;

import org.json.JSONArray;
import org.json.JSONException;
import org.junit.Test;

import tests.AppEngineTest;

import foxtrotbravo.Holiday;

/**
 * The Class HolidayTest.
 *
 * @author Dude
 */
@SuppressWarnings("static-method")
public class HolidayTest extends AppEngineTest
{

  /**
   * Tests the getAll method.
   *
   * @throws JSONException the jSON exception
   */
  @Test
  public void testGetAll() throws JSONException
  {
    JSONArray JA = new JSONArray(Holiday.getAllAsJson());
    for(int i = 0; i < JA.length(); i++)
    {
      assertNotNull(JA.getJSONObject(i).getLong("id"));
      assertNotNull(JA.getJSONObject(i).getString("image"));
      assertNotNull(JA.getJSONObject(i).getString("title"));
      assertNotNull(JA.getJSONObject(i).getString("start"));
      assertEquals("holiday", JA.getJSONObject(i).getString("type"));
    }
  }

}
